package usbcali.edu.persistencia.dto;

import usbcali.edu.persistencia.Salas;

import usbcali.edu.presentation.backEndBeans.SalasView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class SalasDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String estado;
    private String codSala;
    private String descricion;
    private boolean rowSelected = false;
    private SalasView salasView;
    private Salas salas;

    public Salas getSalas() {
        return salas;
    }

    public String listener_update(ActionEvent e) {
        try {
            salasView.action_modifyWitDTO(((codSala == null) ||
                codSala.equals("")) ? null : new String(codSala),
                ((estado == null) || estado.equals("")) ? null
                                                        : new String(estado),
                         ((descricion == null) || descricion.equals("")) ? null
                                                                : new String(descricion)                                           );
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codSala = salas.getCodSala().toString();
        estado = (salas.getEstado() != null) ? salas.getEstado().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codSala = salas.getCodSala().toString();
        estado = (salas.getEstado() != null) ? salas.getEstado().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setSalas(Salas salas) {
        this.salas = salas;
    }

    public SalasView getSalasView() {
        return salasView;
    }

    public void setSalasView(SalasView salasView) {
        this.salasView = salasView;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public String getCodSala() {
        return codSala;
    }

    public void setCodSala(String codSala) {
        this.codSala = codSala;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
